package acm.pta6;

public class 球队食物链 {
    public static void main(String[] args) {
        Reader sc = new Reader();
        int n = sc.nextInt();
        Graph graph = new Graph(n);
        for (int i = 0; i < n; i++) {
            graph.insert(i, sc.nextLine().toCharArray());
        }
        graph.dfs(0, 0);
        if (graph.over) {
            for (int i = 0; i < graph.res.length-1; i++) {
                System.out.print(graph.res[i]+" ");
            }
            System.out.println(graph.res[n-1]);
        } else {
            System.out.println("No Solution");
        }
    }

    public static class Graph {
        public boolean[][] map;
        public int[] res;
        public boolean over;
        public boolean[] visit;


        public Graph(int size) {
            map = new boolean[size][size];
            res = new int[size];
            visit=new boolean[size];
        }

        public void insert(int i, char[] chars) {
            for (int j = 0; j < chars.length; j++) {
                if (chars[j] == 'W') {
                    map[i][j] = true;
                } else if (chars[j] == 'L') {
                    map[j][i] = true;
                }
            }
        }

        /**
         * 两种情况不需要继续往下判断。
         * 1是存在一支没赢过任何人的战队
         * 2是找到了一支符合的食物链
         */
        public void dfs(int deep, int t) {
            if (over || visit[t]) {
                return;
            }
            visit[t]=true;
            res[deep] = t + 1;
            if (deep == map.length - 1) {    //抵达最后一层
                if (map[t][0]) { //战胜过第一支战队
                    over = true;
                }
                visit[t]=false;
                return;
            }
            int j = 1;
            while (j<res.length){
                if (!visit[j]&& map[j][0]) {
                    break;
                }
                j++;
            }
            if (j == res.length) {  //已经无法连城环的情况
                visit[t]=false;
                return;
            }
            for (int i = 0; i < map[t].length; i++) {
                if (map[t][i]) {
                    dfs(deep + 1, i);
                }
            }
            visit[t]=false;
        }
    }

    //    static {
//        String[] str=("-LWDW\n" +
//                "W-LDW\n" +
//                "WW-LW\n" +
//                "DWW-W\n" +
//                "DDLW-").split("\n");
//        char[][] chars=new char[str.length][str.length];
//        for (int i = 0; i < str.length; i++) {
//            chars[i]=str[i].toCharArray();
//        }
//        Graph graph = new Graph(chars);
//        graph.dfs(0,0);
//        System.out.println();
//    }
}
